﻿<?xml version="1.0" encoding="utf-8"?>
<xsd:schema 
	targetNamespace="http://schemas.microsoft.com/dynamics/2008/01/documents/Fault" 
	xmlns:tns="http://schemas.microsoft.com/dynamics/2008/01/documents/Fault" 
	xmlns:xml = "http://www.w3.org/XML/1998/namespace" 
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	elementFormDefault="qualified">

	<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>

	<xsd:element name="Fault" type="tns:Fault"/>

	<xsd:complexType name="Fault" final="extension">
		<xsd:annotation>
			<xsd:documentation>Fault reporting structure for AIF.</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="Code" type="xsd:string" minOccurs="0"/>
			<xsd:element name="Reason" type="tns:FaultReasonType" minOccurs="0"/>
			<xsd:element name="Detail" type="tns:DetailType" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="FaultReasonType">
		<xsd:sequence>
			<xsd:element name="Text" type="tns:ReasonTextType" minOccurs="1" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="ReasonTextType">
		<xsd:simpleContent>
			<xsd:extension base="xsd:string">
				<xsd:attribute ref="xml:lang" use="optional"/>
			</xsd:extension>
		</xsd:simpleContent>
	</xsd:complexType>

	<xsd:complexType name="DetailType">
		<xsd:sequence>
			<xsd:annotation>
				<xsd:documentation xml:lang="en-us">
					The section can contain more information about the fault including one or more elements of type FaultMessageListType.
				</xsd:documentation>
			</xsd:annotation>
			<xsd:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="FaultMessageListType">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="FaultMessage" type="tns:FaultMessageType"/>
		</xsd:sequence>
		<xsd:attribute name="Service" type="xsd:string" use="optional"/>
		<xsd:attribute name="ServiceOperation" type="xsd:string" use="optional"/>
		<xsd:attribute name="ServiceOperationParameter" type="xsd:string" use="optional"/>
		<xsd:attribute name="Document" type="xsd:string" use="optional"/>
		<xsd:attribute name="DocumentOperation" type="xsd:string" use="optional"/>
		<xsd:attribute name="XmlLine" type="xsd:string" use="optional"/>
		<xsd:attribute name="XmlPosition" type="xsd:string" use="optional"/>
		<xsd:attribute name="XPath" type="xsd:string" use="optional"/>
		<xsd:attribute name="Field" type="xsd:string" use="optional"/>
	</xsd:complexType>

	<xsd:complexType name="FaultMessageType">
		<xsd:sequence>
			<xsd:element name="Value" type="xsd:string"/>
		</xsd:sequence>
		<xsd:attribute name="Code" type="xsd:string" use="optional"/>
	</xsd:complexType>
</xsd:schema>